Skip to main content

2.9 Restructuring datasets

Ordinary cross-sectional datasets are created in microdata.no by using the import command to add one variable at a time. The dataset will then contain information at the variable level, where each unit (individual) has one record each. To add repetitive measurements of a variable, this must be done by importing the relevant variable several times with new time indications. This data format is often called "wide-format" since information is organised horizontally.

Data can also be organised vertically as paneldata, also called "long-format". The command import-panel can be used for this, where you specify a set of variables, as well as a set of measurement dates at which you want the information to be measured. Each unit (individual) will in this case have more than one record, depending on how many measurement dates are specified.

Sections 2.3.1 and 2.4 explain the principles surrounding these two main types of data organisation in more detail.

It is also possible to restructure the data organisation from cross-sectional format (wide) to paneldata format (long) and vice versa by using respectively the reshape-to-panel and reshape-from-panel commands. The following sections will explain how to use these two commands.